package com.kuhyygy.xml;

import java.io.InputStream;
import java.util.List;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;



import com.kuhyygy.bean.Person;

public class XmlService {
	
	public static List<Person> readXml(InputStream ins) throws Exception {
		SAXParserFactory spf = SAXParserFactory.newInstance();
		SAXParser sp = spf.newSAXParser();
		BaseXmlHandler bxh = new BaseXmlHandler();
		sp.parse(ins, bxh);
		ins.close();
		return bxh.getPersons();
	}
	
}
